//
// Description: 1436. 旅行终点站
// Created by Loading on 2021/10/1.
//

#include <bits/stdc++.h>

using namespace std;

string destCity(vector<vector<string>> &paths) {
    unordered_set<string> set;
    for (auto &v : paths) {
        set.insert(v[0]);
    }
    for (auto &v :paths) {
        if (set.find(v[1]) == set.end()) {
            return v[1];
        }
    }

    return "";
}

int main() {
    vector<vector<string>> paths = {{"London",   "New York"},
                                    {"New York", "Lima"},
                                    {"Lima",     "Sao Paulo"}};
    string res = destCity(paths);
    cout << res << endl;

    return 0;
}